package merisis.impl;

import java.util.Iterator;
import java.util.NoSuchElementException;

public class SpindleLayerIterator implements Iterator<SiloDisk> {

	private SiloDisk current;

	public SpindleLayerIterator(SiloDisk current) {

		this.current = current;
	}

	public boolean hasDeeper() {

		return false;
	}

	public boolean hasNext() {
		return current != null;
	}

	public void remove() {
		throw new UnsupportedOperationException();
	}

	public SiloDisk next() {

		if (current == null)
			throw new NoSuchElementException();

		SiloDisk r = current;
		current = current.getPrevious();
		return r;
	}
}